1. Field of the Invention
The invention relates to a method for data compression, and more particularly to a method for image data compression of an image block.
2. Description of the Related Art
Conventional image data compression may be classified into two compression techniques: RGB-to-YUV color space conversion coding and block truncation coding (BTC). An image is compressed using both of the two compression techniques, and the compression technique that results in less errors compared to the original image data is determined to be used, so that the compressed data that relatively saves hardware memory capacity may be accessed with high-speed through a static random access memory (SRAM).
Referring to FIG. 1, a conventional codec architecture for image compression includes an RGB-to-YUV encoder 11, a BTC encoder 12, a YUV-to-RGB decoder 13, a BTC decoder 14, a set of error computation units 15, 16, a comparator 17, and a selecting unit 18.
An original image 10 is compressed by the RGB-to-YUV encoder 11 and the BTC encoder 12 through parallel processing, so as to respectively obtain a first compressed image data corresponding to the RGB-to-YUV encoder 11 and a second compressed image data corresponding to the BTC encoder 12. Then, the first compressed image data is recovered by the YUV-to-RGB decoder 13 to obtain a first recovered image data, and the second compressed image data is recovered by the BTC decoder 14 to obtain a second recovered image data. The error computation unit 15 computes a first total error according to pixel errors between the first recovered image data and the original image data 10, and the error computation unit 16 computes a second total error according to pixel errors between the second recovered image data and the original image data 10. The first and second total errors are provided to the comparator 17, which then enables the selecting unit 18 to select one of the first and second compressed image data that corresponds to a smaller one of the first and second total errors for writing into SRAM 19.
In the aforementioned conventional method for image data compression, the original image data 10 is compressed using two compression techniques simultaneously, and the better one of the compression techniques is determined to be used according to the decompression results, resulting in more power consumption, additional commands, unnecessary decompression circuits, and waste of pipeline numbers and chip area.